package com.spring.cloud;

import com.spring.boot.simplespringbootstarter.service.StarterService;
import com.spring.cloud.entity.Week01;
import com.spring.cloud.service.Week01Service;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

import java.util.Arrays;


@EnableDiscoveryClient
@SpringBootApplication(scanBasePackages = {"com.spring.cloud.service", "com.spring.cloud.controller"})
@MapperScan("com.spring.cloud.dao")
public class ProducerApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(ProducerApplication.class, args);
    }


    @Autowired
    Week01Service week01Service;


    @Autowired
    private StarterService starterService;
    @Override
    public void run(String... strings) throws Exception {
        Week01 byId = week01Service.findById(1);
        System.out.println(byId);

        //服务器启动成功后查询数据库 添加到缓存 redis


        String[] split = starterService.split(",");
        System.out.println("-----"+ Arrays.toString(split));
    }
}
